package com.hejielife.producerconsumer2;

/**
 * 2019年8月2日 下午2:13:05
 * 
 * @author hejielife
 * @despribe Main 可以中断的用餐
 */
public class Main {
	public static void main(String[] args) {
		Table table = new Table(3);
		Thread[] threads = { new MakerThread("MakerThread-1", table, 31415),
				new MakerThread("MakerThread-2", table, 92653), new MakerThread("MakerThread-3", table, 58979),
				new EaterThread("EaterThread-1", table, 32384), new EaterThread("EaterThread-2", table, 62643),
				new EaterThread("EaterThread-3", table, 38327), };

		for (int i = 0; i < threads.length; i++) {
			threads[i].start();
		}

		try {
			Thread.sleep(5000);
		} catch (InterruptedException e) {
		}

		System.out.println("***** interrupt *****");

		for (int i = 0; i < threads.length; i++) {
			threads[i].interrupt();
		}
	}
}
